package com.kingzoon.seckill.base.login;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;

/**
 * 
 * @author xiemin
 * @date 2016-10-31下午2:40:15
 * @version 1.0
 */
public final class LoginHelper {
	
	private LoginHelper() {
	}
	
	//用户登录
	public static final Boolean Login(String account ,String password){
		
		UsernamePasswordToken token = new UsernamePasswordToken(account, password);
		token.setRememberMe(true);
		Subject subject = SecurityUtils.getSubject();
		try {
			subject.login(token);
			return subject.isAuthenticated();
		}
		catch (Exception e) {
			e.printStackTrace();
			return false;
		}
	}

}
